package com.xxx.objct;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/16  15:20
 * @Copyright
 */
public class Tset {
    public static void main(String[] args) {
        Student s1 = new Student("张三",30);
        Student s2 = new Student("张三",30);
       // System.out.println(s1==s2);比较的时地址值
//
//        System.out.println( s1.equals(s2));//重写
//
        String str1 = "abc";
        String str2 = "abc";
        System.out.println(str1);
        System.out.println(str2);



//        System.out.println(s1.hashCode());
//        System.out.println(s2.hashCode());


        /*
        * 当判断对象中封装的数据是否相等时
        * 1.对象的hashCode()方法的返回值相同
        * 2.对象的equals(Object obj)方法的比较的数据相等
        * */

        System.out.println(s1);
        System.out.println(s2);
    }
}
